package database;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.log4j.Logger;

public class PersistenceUtil {
	static Logger LOGGER = Logger.getLogger(PersistenceUtil.class);
	private static EntityManagerFactory emf;
	
	public static EntityManager getEntityManager() {
		emf = Persistence.createEntityManagerFactory("datastore");
		return emf.createEntityManager();
	}
	
	public static void closeConnection() {
		emf.close();
	}
}
